import { Setting } from '../database/database'

export default {
    save : async(key, value) => {
        let data = {
            id : key,
            value : value
        }
        await Setting.upsert(data)
        return data
    },
    get : async(key, defaultData = '') => {
        let data = await Setting.findById(key)
        if(data){ return data }
        return { id : key, value : defaultData }
    }
}